//
//  EFTransHomeDetailViewCellThree.m
//  EnjogFood
//
//  Created by guocheng on 2017/5/20.
//  Copyright © 2017年 wf. All rights reserved.
//

#import "EFTransHomeDetailViewCellTotalPrice.h"
#import "EFTransHomeDetailViewItemTotalPrice.h"

@interface EFTransHomeDetailViewCellTotalPrice()

@property(strong,nonatomic) UIView* lineView;
@property(strong,nonatomic) UILabel* totalMoneyLabel;
@property(strong,nonatomic) UILabel* dateLabel;

@end

@implementation EFTransHomeDetailViewCellTotalPrice



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor clearColor];
        self.backgroundColor = [UIColor whiteColor];
        [self initView];
    }
    return self;
}

-(void)initView{
    [self.contentView addSubview:self.lineView];
    [self.contentView addSubview:self.totalMoneyLabel];
    [self.contentView addSubview:self.dateLabel];
}

-(void)setObject:(EFTransHomeDetailViewItemTotalPrice *)item{
    [self.totalMoneyLabel setText:item.money];
    [self.totalMoneyLabel sizeToFit];
    
    self.lineView.left = 20;
    
    self.totalMoneyLabel.top = self.lineView.bottom +  8;
    self.totalMoneyLabel.left = kScreenWidth - self.totalMoneyLabel.width - 20;
    
    
    [self.dateLabel setText:item.date];
    [self.dateLabel sizeToFit];
    
    self.dateLabel.top = self.totalMoneyLabel.bottom +  8;
    self.dateLabel.left = kScreenWidth - self.dateLabel.width - 20;
    
}

-(UIView*)lineView{
    if(_lineView == NULL){
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 40, 1)];
        _lineView.backgroundColor = kBlackDDD;
        
    }
    return _lineView;
}

-(UILabel *)totalMoneyLabel{
    if(_totalMoneyLabel == NULL){
        _totalMoneyLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 20, 24)];
        _totalMoneyLabel.font = [UIFont systemFontOfSize:15];
        _totalMoneyLabel.textColor = kBlack333;
    }
    return _totalMoneyLabel;
}

-(UILabel *)dateLabel{
    if(_dateLabel == NULL){
        _dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 20, 15)];
        _dateLabel.font = [UIFont systemFontOfSize:13];
        _dateLabel.textColor = kBlack999;
    }
    return _dateLabel;
}


@end
